<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */

/**
 * Product description template
 *
 * @see Mage_Catalog_Block_Product_View_Description
 */
?>
<?php $_TabNew = $this->getProduct()->getDescription();
$_product = $this->getProduct();
$_helper = $this->helper('catalog/output'); ?>
<?php if ($_TabNew): ?>
    <h2><?php echo $this->__('Details') ?></h2>
    <div class="std">
        <?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), $_description, 'description') ?>
	          <?php 
           $productId = $this->getRequest()->getParam('id');
                     $array= $this->getdataproductview($productId);
                     $sumarray = count($array);
                   //  echo 'sum array: '. $sumarray;
                     if($sumarray >=0) :
        ?>
        
           <div>
          
              <?php echo $this->getReviewsSummaryHtml($_product, false, true)?> 
			  <?php $sumReview= Mage::getModel('review/review/summary');?>
			  <!--			  <a href="<?php// echo $this->getReviewsUrl() ?>"><?php //echo $this->__('%d Review(s)', $reviewData->getTotalReviews($_product->getId())) ?></a>            -->
               <span><?php echo $this->__('%d Review(s)', $reviewData->getTotalReviews($_product->getId())) ?></span>
                    <?php 
                     $productId = $this->getRequest()->getParam('id');
                     $sku= $this->getdataproductview($productId);
          		 // echo ' productid : '. ($productId) .'and sku[]' .count($sku);
            		 $getname = $this->getnameproduct($productId);
				    // print_r( $sku);
				     echo '<br/>';
				     $count=0;
				     foreach($sku as $item)
				     {
                                         echo '<div style="border-bottom:1px solid #BFBFBF;margin-bottom:10px">';
				         $count=$count+1;
				   //  echo 'SKU: ' . $item['review_id'] . '<br/>';
				        // echo 'Customer ID: '.$item['customer_id']. '<br/>';
				     if($item['customer_id'] == null || $item['customer_id']=='')
				     {
				         $type ='Guest';
				     }
				     else
				     {
				         $type ='Customer';
				     }
				     if($item['customer_id']=='0')
				     {
				         $type ='Admin';
				     }
                    echo      '<div >';
             // echo            ''.$item['review_id']. '   ';
                     echo            '<b>'.$item['nickname']. '</b> on  ';
              echo            ''.date('M d, Y', strtotime($item['created_at'])). ' ('.$getname->getName().' ) ';
              echo               '</div>';
             // echo            ''.$item['status_code'].'   ';
              echo            '<div>';
              echo            ' *****    <b>'.$item['title'].' </b>';
              echo            '</div>';
              echo           '<div>';
              echo            ''.$item['detail'].'   ';
              echo           '</div>';
              echo            '<br/>';
              //echo            ''.$getname->getName().'   ';
             // echo            ''.$item['sku'].   '   ';
           //   echo        '<hr style="background-color: #BFBFBF; border: 0 none; height: 1px; margin-bottom: 10px;>';
                                   
                echo '</div>';
                                   }
                                   //end foreach
                     ?> 
            <br/>

           
    </div>
 
        <?php endif?>
 </div>
<br/>
<?php endif; ?> 
